Apparatus of encoding an image

ABSTRACT

An apparatus of encoding an image can include an intra prediction unit that determines an intra prediction mode of a current prediction unit and generates one or more prediction blocks using the intra prediction mode, an inter prediction unit that determines motion information and generates a prediction block using the motion information, a transform unit that transforms residual signals generated using an original block and the prediction block to generate a transformed block, a quantization unit that determines a quantization parameter and quantizes the transformed block using a quantization matrix and the quantization parameter to generate a quantized block, a scanning unit that determines a scan pattern and applies the scan pattern to the quantized block to generate one-dimensional coefficient information, and an entropy coding unit the entropy-codes one-dimensional coefficient information from the scanning unit, intra prediction information from the intra prediction unit, and motion information from the inter prediction unit.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation of co-pending U.S. application Ser.No. 14/621,015 filed on Feb. 12, 2015, which is a Continuation of U.S.application Ser. No. 14/349,627 filed on Apr. 3, 2014 (now U.S. Pat. No.8,989,258), which is a National Stage of International PatentApplication No. PCT/CN2012/083991 filed on Nov. 2, 2012, which claimspriority to Korean Patent Application No. 10-2011-0114608 filed on Nov.4, 2011. The entire contents of all of the above applications are herebyincorporated by reference.

BACKGROUND OF THE INVENTION

Field of the Disclosure

The present invention relates to a method and an apparatus of decodingan image, and more particularly, to a method and apparatus of generatinga quantized block by adaptively determining an inverse scan patternbased on an intra prediction mode and a size of a transform unit.

Description of the Related Art

In H.264/MPEG-4 AVC, one picture is divided into macroblocks to encodean image, the respective macroblocks are encoded by generating aprediction block using inter prediction or intra prediction. Thedifference between an original block and the prediction block istransformed to generate a transformed block, and the transformed blockis quantized using a quantization parameter and one of a plurality ofpredetermined quantization matrices. The quantized coefficient of thequantized block are scanned by a predetermined scan type and thenentropy-coded. The quantization parameter is adjusted per macroblock andencoded using a previous quantization parameter.

Meanwhile, techniques using various sizes of coding unit and transformunit are introduced to improve the coding efficacy. Techniquesincreasing a number of intra prediction modes are also introduces togenerate a prediction block more similar to an original block.

But, the various sizes of coding unit and transform unit results inincrease of coding bits of residual block when scanning a largetransformed block. Also, the increase of the number of intra predictionmodes requires more effective scanning method to reduce the coding bitsof residual block.

SUMMARY OF THE INVENTION

The present invention is directed to a method of deriving an intraprediction mode of a prediction unit, selecting an inverse scan patternof a current transform unit based on the intra prediction mode and asize of the transform unit, and generating the quantized block byinversely scanning significant flags, coefficients signs and coefficientlevels according to the selected inverse scan pattern.

One aspect of the present invention provides a method of generating aquantized block, comprising: deriving an intra prediction mode of aprediction unit, selecting an inverse scan pattern of a currenttransform unit among a diagonal scan, a vertical scan and a horizontalscan based on the intra prediction mode and a size of the transformunit, and generating the quantized block by inversely scanningsignificant flags, coefficients signs and coefficient levels accordingto the selected inverse scan pattern.

A method according to the present invention derives an intra predictionmode of a prediction unit, selects an inverse scan pattern of a currenttransform unit among a diagonal scan, a vertical scan and a horizontalscan based on the intra prediction mode and a size of the transformunit, and generates a quantized block by inversely scanning significantflags, coefficients signs and coefficient levels according to theselected inverse scan pattern. If the transform unit is larger than apredetermined size, multiple subsets are generated and inverselyscanned. Therefore, the amount of coding bits of the residual block isreduced by determining the scan pattern based on the size of thetransform unit and the intra prediction mode, and by applying the scanpattern to each subset.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an image coding apparatus according to thepresent invention.

FIG. 2 is a conceptual diagram illustrating intra prediction modesaccording to the present invention.

FIG. 3 is a conceptual diagram illustrating scan patterns according tothe present invention.

FIG. 4 is a conceptual diagram illustrating diagonal scan according thepresent invention.

FIG. 5 is a conceptual diagram illustrating scan pattern determined bythe intra prediction mode and the size of the transform unit accordingto the present invention.

FIG. 6 is a block diagram of an image decoding apparatus 200 accordingto the present invention.

FIG. 7 is a flow chart illustrating a method of generating a predictionblock according to the present invention.

DETAILED DESCRIPTION OF THE EMBODIMENTS

Hereinafter, various embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings.However, the present invention is not limited to the exemplaryembodiments disclosed below, but can be implemented in various types.Therefore, many other modifications and variations of the presentinvention are possible, and it is to be understood that within the scopeof the disclosed concept, the present invention may be practicedotherwise than as has been specifically described.

FIG. 1 is a block diagram of an image coding apparatus 100 according tothe present invention.

Referring to FIG. 1, the image coding apparatus 100 according to thepresent invention includes a picture division unit 101, a transform unit103, a quantization unit 104, a scanning unit 105, an entropy codingunit 106, an inverse quantization unit 107, an inverse transform unit108, a post-processing unit 110, a picture storing unit 111, an intraprediction unit 112, an inter prediction unit 113, a subtracter 102 andan adder 109.

The picture division unit 101 divides a picture or a slice into aplurality of largest coding units (LCUs), and divides each LCU into oneor more coding units. The picture division unit 101 determinesprediction mode of each coding unit and a size of prediction unit and asize of transform unit.

An LCU includes one or more coding units. The LCU has a recursive quadtree structure to specify a division structure. Information specifyingthe maximum size and the minimum size of the coding unit is included ina sequence parameter set. The division structure is specified by one ormore split coding unit flags (split_cu_flags). The coding unit has asize of 2N×2N.

A coding unit includes one or more prediction units. In intraprediction, the size of the prediction unit is 2N×2N or N×N. In interprediction, the size of the prediction unit is 2N×2N, 2N×N, N×2N or N×N.When the prediction unit is an asymmetric partition in inter prediction,the size of the prediction unit may also be one of hN×2N, (2−h)N×2N,2N×hN and 2N×(2−h)N. The value of h is ½.

A coding unit includes one or more transform units. The transform unithas a recursive quad tree structure to specify a division structure. Thedivision structure is specified by one or more split transform unitflags (split_tu_flags). Information specifying the maximum size and theminimum size of the transform unit is included in a sequence parameterset.

The intra prediction unit 112 determines an intra prediction mode of acurrent prediction unit and generates one or more prediction blocksusing the intra prediction mode. The prediction block has the same sizeof the transform unit.

FIG. 2 is a conceptual diagram illustrating intra prediction modesaccording to the present invention. As shown in FIG. 2, the number ofintra prediction modes is 35. The DC mode and the planar mode arenon-directional intra prediction modes and the others are directionalintra prediction modes.

The inter prediction unit 113 determines motion information of thecurrent prediction unit using one or more reference pictures stored inthe picture storing unit 111, and generates a prediction block of theprediction unit. The motion information includes one or more referencepicture indexes and one or more motion vectors.

The transform unit 103 transforms residual signals generated using anoriginal block and a prediction block to generate a transformed block.The residual signals are transformed by the transform unit. A transformtype is determined by the prediction mode and the size of the transformunit. The transform type is a DCT-based integer transform or a DST-basedinteger transform.

The quantization unit 104 determines a quantization parameter forquantizing the transformed block. The quantization parameter is aquantization step size. The quantization parameter is determined perquantization unit. The size of the quantization unit is one of allowablesizes of coding unit. If a size of the coding unit is equal to or largerthan a minimum size of the quantization unit, the coding unit is set asthe quantization unit. A plurality of coding units may be included in aquantization unit. The minimum size of the quantization unit isdetermined per picture and one parameter is used for specifying theminimum size of the quantization unit. The parameter is included in apicture parameter set.

The quantization unit 104 generates a quantization parameter predictorand generates a differential quantization parameter by subtracting thequantization parameter predictor from the quantization parameter. Thedifferential quantization parameter is encoded and transmitted to thedecoder. If there are no residual signals to be transmitted within thecoding unit, the differential quantization parameter of the coding unitmay not be transmitted.

The quantization parameter predictor is generated by using quantizationparameters of neighboring coding units and quantization parameter ofprevious coding unit as follows.

A left quantization parameter, an above quantization parameter and aprevious quantization parameter are sequentially retrieved in thisorder. An average of the first two available quantization parametersretrieved in that order is set as the quantization parameter predictorwhen two or more quantization parameters are available, and when onlyone quantization parameter is available, the available quantizationparameter is set as the quantization parameter predictor. That is, ifthe left and above quantization parameter are available, the average ofthe left and above quantization parameter is set as the quantizationparameter predictor. If only one of the left and above quantizationparameter is available, the average of the available quantizationparameter and the previous quantization parameter is set as thequantization parameter predictor. If both of the left and abovequantization parameter are unavailable, the previous quantizationparameter is set as the quantization parameter predictor. The average isrounded off.

The differential quantization parameter is converted into an absolutevalue of the differential quantization parameter and a sign flagindicting the sign of the differential quantization parameter. Theabsolute value of the differential quantization parameter is binarizedas truncated unary. Then, the absolute value and the sign flag arearithmetically coded. If the absolute value is zero, the sign flag doesnot exist.

The quantization unit 104 quantizes the transformed block using aquantization matrix and the quantization parameter. The quantized blockis provided to the inverse quantization unit 107 and the scanning unit105.

The scanning unit 105 determines a scan pattern and applies the scanpattern to the quantized block.

In intra prediction, the distribution of the quantized transformcoefficients varies according to the intra prediction mode and the sizeof the transform unit. Thus, the scan pattern is determined by the intraprediction mode and the size of the transform unit. The size of thetransform unit, the size of transformed block and the size of thequantized block are same.

FIG. 3 is a conceptual diagram illustrating scan patterns according tothe present invention. FIG. 4 is a conceptual diagram illustrating adiagonal scan according the present invention. As shown in FIG. 3, thefirst scan pattern is a zigzag scan, the second scan pattern is ahorizontal scan, and the third scan pattern is a vertical scan.

When CAVLC (Context adaptive variable length coding) is used for entropycoding, one scan pattern is selected among the zigzag scan, thehorizontal scan and the vertical scan. But, when CABAC (Context adaptivebinary arithmetic coding) is used for entropy coding, one scan patternis selected among the diagonal scan, the horizontal scan and thevertical scan and the selected scan pattern is applied to thesignificant flags, coefficient signs and coefficient levels of thequantized block respectively. The significant flag indicates whether thecorresponding quantized transform coefficient is zero or not. Thecoefficient sign indicates a sign of non-zero quantized transformcoefficient, and the coefficients level indicates an absolute value ofnon-zero quantized transform coefficient.

FIG. 5 is a conceptual diagram illustrating exemplary scan patterndetermined by the intra prediction mode and the size of the transformunit according to the present invention. When CABAC is used for entropycoding, the scan pattern is determined as follows.

When the size of the transform unit is 4×4, the horizontal scan isapplied for the vertical mode (mode 1) and a first number of neighboringintra prediction modes of the vertical mode, the vertical scan isapplied for the horizontal mode (mode 2) and the first number ofneighboring intra prediction modes of the horizontal mode, and thediagonal scan is applied for all other intra prediction modes. That is,if it is supposed that the allowable intra prediction modes for 4×4 aremodes 0 to 17, the horizontal scan is applied for mode 5, mode 6 andallowable modes between mode 5 and mode 6, and the vertical scan isapplied for mode 8, mode 9 and allowable modes between mode 8 and 9. Ifthe allowable intra prediction modes for 4×4 are modes 0 to 34, theapplied scan pattern is the same of the following 8×8 transform unit.

When the size of the transform unit is 8×8, the horizontal scan isapplied for the vertical mode (mode 1) and a second number ofneighboring intra prediction modes of the vertical mode, the verticalscan is applied for the horizontal mode (mode 2) and the second numberof neighboring intra prediction modes of the vertical mode, and thediagonal scan is applied for all other intra prediction modes. That is,the horizontal scan is applied for mode 5, mode 6 and allowable modesbetween mode 5 and mode 6, the vertical scan is applied for mode 8, mode9 and allowable modes between mode 8 and 9, and the diagonal scan isapplied for all other intra prediction modes. The allowable modesbetween mode 5 and mode 6 are modes 21, 12, 22, 1, 23, 13 and 24. Theallowable modes between mode 8 and mode 9 are modes 29, 16, 30, 2, 31,17, 32 and 9.

In inter prediction, a predetermined scan pattern is used regardless ofthe size of the transform unit. The predetermined scan pattern is thediagonal scan when the CABAC is used for entropy coding.

When the size of the transform unit is larger than a second size, thequantized block is divided into a main subset and a plurality ofremaining subsets and the determined scan pattern is applied to eachsubset. Significant flags, coefficient signs and coefficients levels ofeach subset are scanned respectively according to the determined scanpattern. The quantized transform coefficients are split into significantflags, coefficient signs and coefficients levels.

The main subset includes DC coefficient and the remaining subsets coversthe region other than the region covered by the main subset. The secondsize is 4×4. A size of the subset may be 4×4 block or a non-square blockdetermined by the scan pattern. The non-square block includes 16transform coefficients. For example, the size of the subset is 8×2 forthe horizontal scan, 2×8 for the vertical scan and 4×4 for the diagonalscan.

The scan pattern for scanning the subsets is the same as the scanpattern for scanning quantized transform coefficients of each subset.The quantized transform coefficients of each subset are scanned in thereverse direction. The subsets are also scanned in the reversedirection.

Last non-zero coefficient position is encoded and transmitted to thedecoder. The last non-zero coefficient position specifies a position oflast non-zero quantized transform coefficient within the transform unit.The last non-zero coefficient position is used to determine the numberof subsets to be signaled in the decoder. Non-zero subset flag is setfor the each subset other than the main subset and the last subset. Thelast subset covers the last non-zero coefficient. The non-zero subsetflag indicates whether the subset contains non-zero coefficients or not.

The inverse quantization unit 107 inversely quantizes the quantizedtransform coefficients of the quantized block.

The inverse transform unit 108 inversely transforms the inversequantized block to generate residual signals of the spatial domain.

The adder 109 generates a reconstructed block by adding the residualblock and the prediction block.

The post-processing unit 110 performs a deblocking filtering process forremoving blocking artifact generated in a reconstructed picture.

The picture storing unit 111 receives post-processed image from thepost-processing unit 110, and stores the image in picture units. Apicture may be a frame or a field.

The entropy coding unit 106 entropy-codes the one-dimensionalcoefficient information received from the scanning unit 105, intraprediction information received from the intra prediction unit 112,motion information received from the inter prediction unit 113, and soon.

FIG. 6 is a block diagram of an image decoding apparatus 200 accordingto the present invention.

The image decoding apparatus 200 according to the present inventionincludes an entropy decoding unit 201, an inverse scanning unit 202, aninverse quantization unit 203, an inverse transform unit 204, an adder205, a post processing unit 206, a picture storing unit 207, an intraprediction unit 208 and an inter prediction unit 209.

The entropy decoding unit 201 extracts the intra prediction information,the inter prediction information and the one-dimensional coefficientinformation from a received bit stream. The entropy decoding unit 201transmits the inter prediction information to the inter prediction unit209, the intra prediction information to the intra prediction unit 208and the coefficient information to the inverse scanning unit 202.

The inverse scanning unit 202 uses an inverse scan pattern to generate aquantized block. When CABAC is used for entropy coding, the scan patternis determined as follows.

The inverse scan pattern is selected among the diagonal scan, thevertical scan and the horizontal scan.

In intra prediction, the inverse scan pattern is determined by the intraprediction mode and the size of the transform unit. The inverse scanpattern is selected among a diagonal scan, vertical scan and horizontalscan. The selected inverse scan pattern is applied to significant flags,coefficient signs and coefficients levels respectively to generate thequantized block.

When the size of the transform unit is equal to or smaller than a firstsize, the horizontal scan is selected for the vertical mode and apredetermined number of neighboring intra prediction modes of thevertical mode, the vertical scan is selected for the horizontal mode andthe predetermined number of neighboring intra prediction modes of thehorizontal mode, and the diagonal scan is selected for the other intraprediction modes. When the size of the transform unit is larger than thefirst size, the diagonal scan is used. When the size of the transformunit is larger than the first size, the diagonal scan is selected forall intra prediction modes. The first size is 8×8.

When the size of the transform unit is 4×4, the horizontal scan isapplied for the vertical mode (mode 1) and a first number of intraprediction modes having closest direction to the vertical mode, thevertical scan is applied for the horizontal mode (mode 2) and the firstnumber of intra prediction modes having closest direction to thehorizontal mode, and the diagonal scan is applied for all other intraprediction modes. That is, if it is supposed that the allowable intraprediction modes for 4×4 are modes 0 to 17, the horizontal scan isapplied for mode 5, mode 6 and allowable modes between mode 5 and mode6, and the vertical scan is applied for mode 8, mode 9 and allowablemodes between mode 8 and 9. If the allowable intra prediction modes for4×4 are modes 0 to 34, the applied scan pattern is the same of thefollowing 8×8 transform unit.

When the size of the transform unit is 8×8, the horizontal scan isapplied for the vertical mode (mode 1) and a second number of intraprediction modes having closest direction to the vertical mode, thevertical scan is applied for the horizontal mode (mode 2) and the secondnumber of intra prediction modes having closest direction to thevertical mode, and the diagonal scan is applied for all other intraprediction modes. That is, the horizontal scan is applied for mode 5,mode 6 and allowable modes between mode 5 and mode 6, the vertical scanis applied for mode 8, mode 9 and allowable modes between mode 8 and 9,and the diagonal scan is applied for all other intra prediction modes.The allowable modes between mode 5 and mode 6 are modes 21, 12, 22, 1,23, 13 and 24. The allowable modes between mode 8 and mode 9 are modes29, 16, 30, 2, 31, 17, 32 and 9.

In inter prediction, the diagonal scan is used.

When the size of the transform unit is larger than the second size, thesignificant flags, the coefficient signs and the coefficients levels areinversely scanned in the unit of subset using the determined inversescan pattern to generate subsets, and the subsets are inversely scannedto generate the quantized block. The second size is 4×4. The size of thesubset may be 4×4 block or a non-square block determined by the scanpattern. The non-square block includes 16 transform coefficients. Forexample, the size of the subset is 8×2 for the horizontal scan, 2×8 forthe vertical scan and 4×4 for the diagonal scan.

The inverse scan pattern used for generating each subset is the same asthe inverse scan pattern used for generating the quantized block. Thesignificant flags, the coefficient signs and the coefficient levels areinversely scanned in the reverse direction. The subsets are alsoinversely scanned in the reverse direction.

The last non-zero coefficient position and the non-zero subset flags arereceived from the encoder. The number of encoded subsets is determinedaccording to the last non-zero coefficient position and the inverse scanpattern. The non-zero subset flags are used to select subsets to begenerated. The main subset and the last subset are generated using theinverse scan pattern.

The inverse quantization unit 203 receives the differential quantizationparameter from the entropy decoding unit 201 and generates thequantization parameter predictor. The quantization parameter predictoris generated through the same operation of the quantization unit 104 ofFIG. 1. Then, the inverse quantization unit 203 adds the differentialquantization parameter and the quantization parameter predictor togenerate the quantization parameter of the current coding unit. If thesize of the current coding unit is equal to or larger than the minimumsize of the quantization unit and the differential quantizationparameter for the current coding unit is not received from the encoder,the differential quantization parameter is set to 0.

The quantization parameter is generated per quantization unit. If thesize of the coding unit is equal to or larger than the minimum size ofthe quantization unit, the quantization parameter is generated for thecoding unit. If plural coding units are included in a quantization unit,the quantization parameter is generated for the first coding unitcontaining one or more non-zero coefficients in decoding order. Thecoding units after the first coding unit within the quantization unithave the same quantization parameter as that of the first coding unit.

The minimum size of the quantization unit is derived per picture usingonly one parameter included in the picture parameter set and the size ofthe largest coding unit.

The differential quantization parameter is restored per quantizationunit. The encoded differential quantization parameter is arithmeticallydecoded to generate the absolute value of the differential quantizationparameter and the sign flag indicting the sign of the differentialquantization parameter. The absolute value of the differentialquantization parameter is a bin string of truncated unary. Then, thedifferential quantization parameter is restored using the absolute valueand the sign flag. If the absolute value is zero, the sign flag does notexist.

The inverse quantization unit 203 inversely quantizes the quantizedblock.

The inverse transform unit 204 inversely transforms the inverselyquantized block to restore a residual block. The inverse transform typeis adaptively determined according to the prediction mode and the sizeof the transform unit. The inverse transform type is the DCT-basedinteger transform or the DST-based integer transform.

The intra prediction unit 208 restores the intra prediction mode of thecurrent prediction unit using the received intra prediction information,and generates a prediction block according to the restored intraprediction mode.

The inter prediction unit 209 restores the motion information of thecurrent prediction unit using the received inter prediction information,and generates a prediction block using the motion information.

The post-processing unit 206 operates the same as the post-processingunit 110 of FIG. 1.

The picture storing unit 207 receives post-processed image from thepost-processing unit 206, and stores the image in picture units. Apicture may be a frame or a field.

The adder 205 adds the restored residual block and a prediction block togenerate a reconstructed block.

FIG. 7 is a flow chart illustrating a method of generating a predictionblock according to the present invention.

Intra prediction information of the current prediction unit isentropy-decoded (S110).

The intra prediction information includes a mode group indicator and aprediction mode index. The mode group indicator is a flag indicatingwhether the intra prediction mode of the current prediction unit belongsto a most probable mode group (MPM group). If the flag is 1, the intraprediction unit of the current prediction unit belongs to the MPM group.If the flag is 0, the intra prediction unit of the current predictionunit belongs to a residual mode group. The residual mode group includesall intra prediction modes other than the intra prediction modesbelonging to the MPM group. The prediction mode index specifies theintra prediction mode of the current prediction unit within the groupspecified by the mode group indicator.

The MPM group is constructed using intra prediction modes of theneighboring prediction units (S120).

The intra prediction modes of the MPM group are adaptively determined bya left intra prediction mode and an above intra prediction mode. Theleft intra prediction mode is the intra prediction mode of the leftneighboring prediction unit, and the above intra prediction mode is theintra prediction mode of the above neighboring prediction unit. The MPMgroup is comprised of three intra prediction modes.

If the left or above neighboring prediction unit does not exist, theintra prediction mode of the left or above neighboring unit is set asunavailable. For example, if the current prediction unit is located atthe left or upper boundary of a picture, the left or above neighboringprediction unit does not exist. If the left or above neighboring unit islocated within other slice or other tile, the intra prediction mode ofthe left or above neighboring unit is set as unavailable. If the left orabove neighboring unit is inter-coded, the intra prediction mode of theleft or above neighboring unit is set as unavailable. If the aboveneighboring unit is located within other LCU, the intra prediction modeof the left or above neighboring unit is set as unavailable.

When both of the left intra prediction mode and the above intraprediction mode are available and are different each other, the leftintra prediction mode and the above intra prediction mode are includedin the MPM group and one additional intra prediction mode is added tothe MPM group. Index 0 is assigned to one intra prediction mode of smallmode number and index 1 is assigned to the other. Or index 0 is assignedto the left intra prediction mode and index 1 is assigned to the aboveintra prediction mode. The added intra prediction mode is determined bythe left and above intra prediction modes as follows.

If one of the left and above intra prediction modes is a non-directionalmode and the other is a directional mode, the other non-directional modeis added to the MPM group. For example, if the one of the left and aboveintra prediction modes is the DC mode, the planar mode is added to theMPM group. If the one of the left and above intra prediction modes isthe planar mode, the DC mode is added to the MPM group. If both of theleft and above intra prediction modes are non-directional modes, thevertical mode is added to the MPM group. If both of the left and aboveintra prediction modes are directional modes, the DC mode or the planarmode is added to the MPM group.

When only one of the left intra prediction mode and the above intraprediction mode is available, the available intra prediction mode isincluded in the MPM group and two additional intra prediction modes areadded to the MPM group. The added two intra prediction modes aredetermined by the available intra prediction modes as follows.

If the available intra prediction mode is a non-directional mode, theother non-directional mode and the vertical mode are added to the MPMgroup. For example, if the available intra prediction mode is the DCmode, the planar mode and the vertical mode are added to the MPM group.If the available intra prediction mode is the planar mode, the DC modeand the vertical mode are added to the MPM group. If the available intraprediction mode is a directional mode, two non-directional modes (DCmode and planar mode) are added to the MPM group.

When both of the left intra prediction mode and the above intraprediction mode are available and are the same each other, the availableintra prediction mode is included in the MPM group and two additionalintra prediction modes are added to the MPM group. The added two intraprediction modes are determined by the available intra prediction modesas follows.

If the available intra prediction mode is a directional mode, twoneighboring directional modes are added to the MPM group. For example,if the available intra prediction mode is the mode 23, the leftneighboring mode (mode 1) and the right neighboring mode (mode 13) areadded to the MPM group. If the available intra prediction mode is themode 30, the two neighboring modes (mode 2 and mode 16) are added to theMPM group. If the available intra prediction mode is a non-directionalmode, the other non-directional mode and the vertical mode are added tothe MPM group. For example, if the available intra prediction mode isthe DC mode, the planar mode and the vertical mode are added to the MPMgroup.

When both of the left intra prediction mode and the above intraprediction mode are unavailable, three additional intra prediction modesare added to the MPM group. The three intra prediction modes are the DCmode, the planar mode and the vertical mode. Indexes 0, 1 and 2 areassigned to the three intra prediction modes in the order of the DCmode, the planar mode and the vertical mode or in the order of theplanar mode, the DC mode and the vertical mode.

It is determined whether the mode group indicator designates the MPMgroup (S130).

If the mode group indicator indicates the MPM group, the intraprediction of the MPM group specified by the prediction mode index isset as the intra prediction mode of the current prediction unit (S140).

If the mode group indicator does not indicate the MPM group, the intraprediction is derived by comparing the prediction mode index and theintra prediction modes of the MPM group as the following ordered steps(S150).

1) Among the three intra prediction modes of the MPM group, the intraprediction mode with lowest mode number is set to a first candidate, theintra prediction mode with middle mode number is set to a secondcandidate, and the intra prediction mode with highest mode number is setto a third candidate.

2) The prediction mode index is compared with the first candidate. Ifthe prediction mode index is equal to or greater than the firstcandidate of the MPM group, the value of the prediction mode index isincreased by one. Otherwise, the value of the prediction mode index ismaintained.

3) The prediction mode index is compared with the second candidate. Ifthe prediction mode index is equal to or greater than the secondcandidate of the MPM group, the value of the prediction mode index isincreased by one. Otherwise, the value of the prediction mode index ismaintained.

4) The prediction mode index is compared with the third candidate. Ifthe prediction mode index is equal to or greater than the thirdcandidate of the MPM group, the value of the prediction mode index isincreased by one. Otherwise, the value of the prediction mode index ismaintained.

5) The value of the final prediction mode index is set as the modenumber of the intra prediction mode of the current prediction unit.

A size of the prediction block is determined based on the transform sizeindicator specifying the size of the transform unit (S160). Thetransform size indicator may be a split_transform_flag specifying thesize of the transform unit.

If the size of the transform unit is equal to the size of the currentprediction unit, the prediction block is generated through the followingsteps S170˜S190.

If the size of the transform unit is smaller than the size of thecurrent prediction unit, a prediction block of the first sub-block ofthe current prediction unit is generated through the steps S170 to S190,a residual block of the first current sub-block is generated and areconstructed block of the first sub-block is generated by adding theprediction block and the residual block. Then, a reconstructed block ofthe next sub-block in decoding order is generated. The same intraprediction mode is used for all the sub-block. The sub-block has thesize of the transform unit.

It is determined whether all reference pixels of the current block areavailable, and reference pixels are generated if one or more referencepixels are unavailable (S170). The current block is the currentprediction unit or the sub-block. The size of the current block is thesize of the transform unit.

The reference pixels are adaptively filtered based on the intraprediction mode and the size of the current block (S180). The size ofthe current block is the size of the transform unit.

In the DC mode, the vertical mode and the horizontal mode, the referencepixels are not filtered. In the directional modes other than thevertical and horizontal modes, the reference pixels are adaptivelyaccording to the size of the current block.

If the size of the current block is 4×4, the reference pixels are notfiltered in all intra prediction modes. For the size 8×8, 16×16 and32×32, the number of intra prediction mode where the reference pixelsare filtered increases as the size of the current block becomes larger.For example, the reference pixels are not filtered in the vertical modeand a predetermined number of neighboring intra prediction mode of thevertical mode. The reference pixels are also not filtered in thehorizontal mode and the predetermined number of neighboring intraprediction mode of the horizontal mode. The predetermined numberdecreases as the size of the current block increases.

A prediction block of the current block is generated using the referencepixels and the intra prediction mode of the current prediction unit(S190).

In the vertical mode, the prediction pixels are generated by copying thevalue of the vertical reference pixel. The prediction pixels adjacent tothe left reference pixel are filtered using the corner reference pixeland the left neighboring reference pixel.

In the horizontal mode, the prediction pixels are generated by copyingthe value of the horizontal reference pixel. The prediction pixelsadjacent to the above reference pixel are filtered using the cornerreference pixel and the above neighboring reference pixel.

While the invention has been shown and described with reference tocertain exemplary embodiments thereof, it will be understood by thoseskilled in the art that various changes in form and details may be madetherein without departing from the spirit and scope of the invention asdefined by the appended claims.

The invention claimed is:
 1. An apparatus of encoding an image,comprising: an intra prediction unit that determines an intra predictionmode of a current prediction unit and generates one or more predictionblocks using the intra prediction mode; an inter prediction unit thatdetermines motion information and generates a prediction block using themotion information; a transform unit that transforms residual signalsgenerated using an original block and the prediction block to generate atransformed block; a quantization unit that determines a quantizationparameter and quantizes the transformed block using a quantizationmatrix and the quantization parameter to generate a quantized block; ascanning unit that determines a scan pattern and applies the scanpattern to the quantized block to generate one-dimensional coefficientinformation; and an entropy coding unit that entropy-codesone-dimensional coefficient information received from the scanning unit,intra prediction information received from the intra prediction unit,and motion information received from the inter prediction unit; whereinthe quantization parameter is encoded using a quantization parameterpredictor, if two or more quantization parameters are available among aleft quantization parameter, an above quantization parameter and aprevious quantization parameter of a current coding unit, thequantization parameter predictor is generated using two availablequantization parameters determined according a predetermined order, andif only one quantization parameter is available, the availablequantization parameter is set as the quantization parameter predictor,wherein a transform type for transforming the residual signals isselected among a DCT-based integer transform and a DST-based integertransform depending on a prediction mode and a size of a transform unit,and wherein when a size of the quantized block is larger than 4×4, thequantized block is divided into plural subsets, significant flags,coefficients signs and coefficient levels of each subset are scannedrespectively according to the determined scan pattern, and the subsetsare scanned according to the determined scan pattern.
 2. The apparatusof claim 1, wherein a size of the prediction block generated by theintra prediction unit is equal to a size of a transform unit, and pluralprediction blocks are generated by the intra prediction unit using theintra prediction mode if a size of the current prediction unit is largerthan the size of the transform unit.
 3. The apparatus of claim 1,wherein if the left and above quantization parameters are available, anaverage of the left and above quantization parameters is set as thequantization parameter predictor.
 4. The apparatus of claim 1, whereinif the left quantization parameter is not available, an average of theabove quantization parameter and the previous quantization parameter isset as the quantization parameter predictor.
 5. The apparatus of claim1, wherein the quantization parameter is generated per quantizationunit, and a minimum size of the quantization unit is adjusted perpicture.
 6. The apparatus of claim 1, wherein the quantization unit hasa size of a coding unit equal to or larger than a reference size, andthe reference size is a minimum size of the quantization unit.
 7. Theapparatus of claim 6, wherein the minimum size of the quantization unitis one of allowable sizes of the coding unit.
 8. The apparatus of claim1, wherein the scan pattern is determined by the intra prediction modeand the size of the transform unit in intra prediction.
 9. The apparatusof claim 8, wherein if the size of the transform unit is larger than4×4, the quantized block is divided into a plurality of subsets, thescan pattern is applied to the plurality of subsets, and non-zero subsetflags are determined and encoded.